package com.ruoyi.web.controller.school;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.school.domain.PacJobHonors;
import com.ruoyi.school.service.PacJobHonorsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api("在职荣誉相关接口")
@RestController
@RequestMapping("/school/jobHonors")
public class PacJobHonorsController extends BaseController {
    @Resource
    private PacJobHonorsService jobHonorsService;

    @ApiOperation("在职荣誉相关接口")
    @GetMapping("/list")
    public TableDataInfo list(PacJobHonors pacJobHonors) {
        startPage();
        List<PacJobHonors> list = jobHonorsService.getList(pacJobHonors);
        return getDataTable(list);
    }

    @GetMapping("/details")
    public AjaxResult details(PacJobHonors pacJobHonors) {
        PacJobHonors details = jobHonorsService.getDetails(pacJobHonors);
        return success(details);
    }

    @Log(title = "在职荣誉", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PacJobHonors pacJobHonors) {
        boolean add = jobHonorsService.add(pacJobHonors);
        return success(add);
    }

    @Log(title = "在职荣誉", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    public AjaxResult update(@RequestBody PacJobHonors pacJobHonors) {
        boolean update = jobHonorsService.edit(pacJobHonors);
        return success(update);
    }

    @Log(title = "在职荣誉", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public AjaxResult delete(PacJobHonors pacJobHonors) {
        boolean delete = jobHonorsService.delete(pacJobHonors);
        return success(delete);
    }
}
